﻿/****************************************************************************
Copyright (c) 2014-2015 凌惊雪 微信:Lingjingxue 邮箱:lingjingxue@sina.com QQ:271487457

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/

using UtilLib;
using static UtilPublic.Redis.ServerRedis;
using static ServerBase.DataBaseRedis.RdsTxt;
using System.Collections.Generic;
using ServerBase.Protocol;
using ServerBase.Service;
using static ServerBase.Config.Conf;
using ServerBase.Other;
using static ServerBase.Service.BaseDispatch;
using static UtilPublic.Serialization.Jsh;
using ServerBase.Config;
using UtilPublic.Mysql;
using System.Net;

namespace ServerPublic.Manager
{
    public static class PubPlayerMgr
    {
        
        //获取用户ID
        public static long GetPuid(string name)
        {
            return AHashGet(RdsPlayerNamePuid, name).ToLong();
        }
        //获取用户昵称
        public static string GetName(long Puid)
        {
            return AHashGet(RdsPlayerPuidName, Puid);
        }
        //获取用户等级
        public static int GetLevel(long Puid)
        {
            return AHashGet(RdsPlayerPuidLevel, Puid).ToInt();
        }
        //检查某个PUID的玩家是否存在档案
        public static bool CheckPlayer(long Puid)
        {
            //查询玩家是否存在
            var name = GetName(Puid);
            return (!string.IsNullOrEmpty(name));
        }

    }
}
